package guoanmaker.provider.business.model;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;

import guoanmaker.provider.helper.common.abstractobj.IdEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 
 * @author ZJ
 *
 *         优惠券实体类
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "t_operator_coupons")
public class OperatorCoupons extends IdEntity {
    @Column(name="couponsname")
	private String couponsname; // 优惠券名称
    @Column(name="oprange")
	private String oprange; // 范围
    @Column(name="getway")
	private String getway; // 领取方式
    @Column(name="time_type")
	private String timeType; // 时间方式 0--------》长期 1---------》 时间范围
    @Column(name="startcouponstime")
	private Date startcouponstime;// 优惠券起始时间
    @Column(name="endcouponstime")
	private Date endCouponstime;// 优惠券结束时间
    @Column(name="couponstype")
	private String couponstype;// 优惠券类型 0 ：直减 1：满减 2：打折
    @Column(name="lapseamount")
	private Double lapseamount; // 直减金额
    @Column(name="fullamount")
	private Double fullamount; //满（）金额
    @Column(name="subamount")
	private Double subamount;//减（）金额
    @Column(name="discount")
	private Double discount;//折扣率
    @Column(name="issuenumber")
	private int issuenumber;// 发行数量
    @Column(name="validity_period")
	private int validityPeriod; // 有效期多少天
    @Column(name="eachcoupons")
	private int eachcoupons;// 每人送几张
    @Column(name="iseffect")
	private int iseffect;//是否生效    0----》未生效   1-----》已生效
    @Column(name="totalcost")
	private Double totalcost;//总成本
    @Column(name="beensent")
    private int   beensent; //已送
    @Column(name="beenused")
    private int   beenused; //已用
    @Column(name="createuser")
    private String createuser;//创建人
    @Column(name="createdate")
    private Date createdate;//创建时间
    
    @OneToMany(mappedBy="operatorCoupon",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
	@JSONField(serialize=false)
	private Set<PersonalUserCoupon> puCoupons;
 

}
